﻿using CuaHangLego.DataAccess;
using CuaHangLego.Model;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CuaHangLego.Bussiness.Parser
{
    public class HoaDonBanParser
    {
        public static HoaDonBan Parse(SqlDataReader sdata)
        {
            HoaDonBan hd = new HoaDonBan();
            hd.MaSo = int.Parse(sdata["ID"].ToString());
            hd.KhachHang = KhachHangDA.Instance.GetByID(int.Parse(sdata["KhachHangID"].ToString()));
            hd.ThoiGian = DateTime.Parse(sdata["ThoiGian"].ToString());
            hd.DaThanhToan = int.Parse(sdata["DaThanhToan"].ToString()) == 1 ? true : false;
            return hd;
        }
    }
}
